<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../../common/vue2/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <p>{{message}}</p>
      <button v-on:click="counter += 1">Add 1</button>
      <p>The button above has been clicked {{ counter }} times.</p>
    </div>

    <script type="text/javascript">
      var app = new Vue({
        el: "#app",
        data: {
          message: "Hello Vue!",
          counter: 0,
        },
        methods: {
          greet: function (event) {
            // `this` 在方法里指向当前 Vue 实例
            alert("Hello " + this.name + "!");
            // `event` 是原生 DOM 事件
            if (event) {
              alert(event.target.tagName);
            }
          },
        },
      });
    </script>
  </body>
</html>
